package main.java.indi.zyj.sword;

import main.java.indi.zyj.hot100.base.ListNode;

public class GetIntersectionNode {

    ListNode getIntersectionNode(ListNode headA, ListNode headB) {

        if(headA==null || headB == null) return null;

        ListNode you = headA, me = headB;

        while (you != me) {
            you = you == null ? headB : you.next;
            me = me == null ? headA : me.next;
        }

        return you;

    }

}
